/* 通用样式文件 - 适用于菜单和角色管理页面 */

// 页面容器基础样式
.page-container {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;

    // 全局隐藏列表标签页的关闭图标
    :deep(#tab-list .el-icon-close),
    :deep(#tab-list .el-icon.is-icon-close) {
        display: none !important;
    }

    // Tabs容器占满整个页面
    :deep(.el-tabs) {
        height: 100%;
        display: flex;
        flex-direction: column;

        // 标签页头部样式优化
        .el-tabs__header {
            margin: 0;
            padding: 0;
            background: #ffffff;
            border-bottom: 1px solid #e4e7ed;
            flex-shrink: 0;
            user-select: none;

            // 标签页导航样式
            .el-tabs__nav-wrap {
                padding: 0;

                .el-tabs__nav {
                    border: none;

                    // 标签页按钮样式 - 简化版本
                    .el-tabs__item {
                        height: 44px;
                        line-height: 44px;
                        padding: 0 24px;
                        font-size: 14px;
                        font-weight: 500;
                        color: #606266;
                        background-color: transparent;
                        border: none;
                        border-radius: 0;
                        transition: color 0.3s ease, background-color 0.3s ease;
                        position: relative;
                        margin: 0;

                        &:hover {
                            color: #409eff;
                            background-color: rgba(64, 158, 255, 0.1);
                        }

                        &.is-active {
                            color: #409eff;
                            background: rgba(64, 158, 255, 0.1);
                            border-bottom: 2px solid #409eff;
                            font-weight: 600;
                        }

                        // 关闭按钮样式
                        .el-icon-close {
                            margin-left: 8px;
                            font-size: 12px;
                            color: #c0c4cc;
                            transition: color 0.3s ease;

                            &:hover {
                                color: #f56c6c;
                            }
                        }

                        // 隐藏不可关闭标签页的关闭按钮
                        &:not(.is-closable) .el-icon-close {
                            display: none !important;
                        }

                        // 针对name为list的标签页隐藏关闭图标
                        &[aria-controls="pane-list"] .el-icon-close {
                            display: none !important;
                        }

                        // 确保第一个标签页（列表）不显示关闭图标
                        &:first-child .el-icon-close {
                            display: none !important;
                        }

                        // 针对列表标签页的额外隐藏规则
                        &[data-name="list"] .el-icon-close {
                            display: none !important;
                        }

                        // 针对列表标签页的关闭图标隐藏（基于id）
                        &#tab-list .el-icon-close {
                            display: none !important;
                        }

                        // 针对列表标签页的关闭图标隐藏（基于aria-controls）
                        &[aria-controls="pane-list"] .el-icon-close {
                            display: none !important;
                        }

                        // 针对列表标签页的关闭图标隐藏（基于class组合）
                        &.is-closable[aria-controls="pane-list"] .el-icon-close {
                            display: none !important;
                        }

                        // 强制隐藏列表标签页的关闭图标（多重选择器）
                        &.is-closable[aria-controls="pane-list"] .el-icon.is-icon-close {
                            display: none !important;
                        }

                        // 针对列表标签页的关闭图标隐藏（基于id和class）
                        &#tab-list.is-closable .el-icon-close {
                            display: none !important;
                        }

                        // 针对列表标签页的关闭图标隐藏（基于id和class）
                        &#tab-list.is-closable .el-icon.is-icon-close {
                            display: none !important;
                        }
                    }
                }
            }
        }

        // 标签页内容区域样式
        .el-tabs__content {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            background: transparent;

            .el-tab-pane {
                height: 100%;
                display: flex;
                flex-direction: column;
                background: transparent;

                // 列表内容区域样式
                .list-content {
                    background-color: #fff;
                    padding: 10px 10px 0 10px;
                    border-radius: 0 0 8px 8px;
                    height: 100%;
                    display: flex;
                    flex-direction: column;
                    overflow: hidden;

                    // 搜索表单
                    .search-form {
                        flex-shrink: 0;
                        display: flex;
                        flex-direction: row;
                        align-items: center;
                        justify-content: space-between;
                        flex-wrap: nowrap;
                        overflow: hidden;
                        padding: 4px 16px;
                        // background: #f8f9fa;
                        border-radius: 8px;
                        height: 60px;
                        box-sizing: border-box;

                        // 左侧搜索条件区域
                        .search-conditions {
                            display: flex;
                            align-items: center;
                            flex: 1;
                            height: 100%;

                            // 搜索项样式
                            .search-item {
                                display: flex;
                                align-items: center;
                                margin-right: 16px;
                                height: 100%;

                                .search-label {
                                    line-height: 32px;
                                    margin-right: 8px;
                                    white-space: nowrap;
                                    display: flex;
                                    align-items: center;
                                    color: #606266;
                                    font-size: 14px;
                                    font-weight: 500;
                                }

                                :deep(.el-input) {
                                    width: 180px;

                                    .el-input__wrapper {
                                        height: 32px;
                                        line-height: 32px;
                                        display: flex;
                                        align-items: center;
                                    }
                                }

                                :deep(.el-select) {
                                    .el-input__wrapper {
                                        height: 32px;
                                        line-height: 32px;
                                        display: flex;
                                        align-items: center;
                                    }

                                    .el-input__inner {
                                        height: 32px;
                                        line-height: 32px;
                                        color: #606266;
                                    }

                                    .el-input__placeholder {
                                        color: #c0c4cc;
                                        font-size: 14px;
                                    }
                                }
                            }
                        }

                        // 右侧按钮区域
                        .button-actions {
                            display: flex;
                            align-items: center;
                            flex-shrink: 0;

                            :deep(.el-button) {
                                height: 32px;
                                padding: 0 12px;
                                margin-right: 8px;
                                white-space: nowrap;

                                &:last-child {
                                    margin-right: 0;
                                }
                            }

                            // 按钮组样式
                            :deep(.el-button-group) {
                                margin-right: 12px;

                                .el-button {
                                    margin-right: 0;
                                    border-radius: 0;

                                    &:first-child {
                                        border-top-left-radius: 4px;
                                        border-bottom-left-radius: 4px;
                                    }

                                    &:last-child {
                                        border-top-right-radius: 4px;
                                        border-bottom-right-radius: 4px;
                                    }
                                }
                            }
                        }
                    }

                    // 数据表格
                    :deep(.el-table) {
                        width: 100%;
                        border: 1px solid #ebeef5;
                        border-radius: 4px;
                        overflow: hidden;
                        flex: 1;
                        overflow: auto;

                        .el-table__header-wrapper {
                            background-color: #fafafa;

                            .el-table__header th {
                                background-color: #fafafa !important;
                                border-bottom: 1px solid #ebeef5;
                                border-right: 1px solid #ebeef5;
                                color: #606266;
                                font-weight: 600;
                                padding: 12px 0;

                                &:last-child {
                                    border-right: none;
                                }
                            }
                        }

                        .el-table__body {
                            td {
                                border-bottom: 1px solid #ebeef5;
                                border-right: 1px solid #ebeef5;
                                padding: 12px 0;

                                &:last-child {
                                    border-right: none;
                                }
                            }

                            tr:hover>td {
                                background-color: #f5f7fa;
                            }
                        }

                        // 修复固定列背景色问题
                        .el-table__fixed-header-wrapper {
                            background-color: #fafafa;

                            th {
                                background-color: #fafafa !important;
                            }
                        }

                        .el-table__fixed-body-wrapper {
                            background-color: #ffffff;

                            td {
                                background-color: #ffffff !important;
                            }

                            tr:hover>td {
                                background-color: #f5f7fa !important;
                            }
                        }

                        // 确保所有表头背景色一致
                        .el-table__header-wrapper .el-table__cell {
                            background-color: #fafafa !important;
                        }

                        .el-table__fixed-header-wrapper .el-table__cell {
                            background-color: #fafafa !important;
                        }
                    }

                    // 分页容器样式
                    .pagination-container {
                        margin: 0;
                        padding: 12px 0;
                        display: flex;
                        justify-content: flex-end;
                        align-items: center;
                        background: transparent;
                        border: none;
                        box-shadow: none;
                        width: 100%;
                        min-height: 48px;

                        // 分页组件样式优化
                        :deep(.el-pagination) {
                            --el-pagination-bg-color: transparent;
                            --el-pagination-text-color: #606266;
                            --el-pagination-border-radius: 6px;
                            --el-pagination-button-color: #606266;
                            --el-pagination-button-bg-color: #ffffff;
                            --el-pagination-button-disabled-color: #c0c4cc;
                            --el-pagination-button-disabled-bg-color: #f5f7fa;
                            --el-pagination-hover-color: #409eff;
                            width: 100%;
                            display: flex;
                            justify-content: flex-end;
                            align-items: center;
                            padding: 0;

                            // 分页按钮样式
                            .btn-prev,
                            .btn-next {
                                background-color: #ffffff;
                                border: 1px solid #dcdfe6;
                                color: #606266;
                                transition: all 0.3s ease;
                                border-radius: 6px;
                                padding: 6px 10px;
                                margin: 0 3px;
                                height: 32px;
                                line-height: 20px;

                                &:hover {
                                    background-color: #409eff;
                                    color: #ffffff;
                                    border-color: #409eff;
                                    transform: translateY(-1px);
                                    box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
                                }

                                &:disabled {
                                    background-color: #f5f7fa;
                                    color: #c0c4cc;
                                    border-color: #e4e7ed;
                                    cursor: not-allowed;
                                    transform: none;
                                    box-shadow: none;
                                }
                            }

                            // 页码按钮样式
                            .el-pager li {
                                background-color: #ffffff;
                                border: 1px solid #dcdfe6;
                                color: #606266;
                                transition: all 0.3s ease;
                                border-radius: 6px;
                                margin: 0 2px;
                                min-width: 28px;
                                height: 28px;
                                line-height: 28px;
                                text-align: center;
                                font-size: 13px;

                                &:hover {
                                    background-color: #409eff;
                                    color: #ffffff;
                                    border-color: #409eff;
                                    transform: translateY(-1px);
                                    box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
                                }

                                &.is-active {
                                    background: #409eff;
                                    color: #ffffff;
                                    border-color: #409eff;
                                    font-weight: 600;
                                    box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
                                }
                            }

                            // 跳转输入框样式优化
                            .el-pagination__jump {
                                margin-left: 12px;
                                display: flex;
                                align-items: center;

                                .el-input {
                                    width: 45px;
                                    margin: 0 6px;

                                    .el-input__wrapper {
                                        border-radius: 6px;
                                        border: 1px solid #dcdfe6;
                                        box-shadow: none;
                                        padding: 0;
                                        height: 28px;

                                        &:hover {
                                            border-color: #c0c4cc;
                                        }

                                        &.is-focus {
                                            border-color: #409eff;
                                            box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
                                        }
                                    }

                                    .el-input__inner {
                                        border: none;
                                        text-align: center;
                                        padding: 6px 4px;
                                        font-size: 13px;
                                        background: transparent;
                                        box-shadow: none;
                                        height: 28px;
                                        line-height: 16px;
                                    }
                                }
                            }

                            // 每页条数选择器样式
                            .el-pagination__sizes {
                                margin-right: 12px;

                                .el-select {
                                    width: 100px;

                                    .el-input__wrapper {
                                        border-radius: 6px;
                                        border: 1px solid #dcdfe6;
                                        box-shadow: none;
                                        height: 28px;

                                        &:hover {
                                            border-color: #c0c4cc;
                                        }

                                        &.is-focus {
                                            border-color: #409eff;
                                            box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
                                        }
                                    }
                                }
                            }

                            // 总数显示样式
                            .el-pagination__total {
                                color: #606266;
                                font-weight: 500;
                                margin-right: 12px;
                                font-size: 13px;
                            }
                        }
                    }
                }

                // 编辑内容区域样式
                .edit-content {
                    height: 100%;
                    display: flex;
                    flex-direction: column;
                    overflow: hidden;
                    background: transparent;
                }
            }
        }
    }
}

// 表单组件通用样式
.form-container {
    padding: 20px;
    background-color: #fff;
    border-radius: 4px;
    height: 100%;
    overflow-y: auto;

    .el-form {
        max-width: 700px;
    }

    .el-form-item {
        margin-bottom: 20px;
    }

    .el-form-item:last-child {
        margin-bottom: 0;
        text-align: center;
    }
}

// 权限树样式
.permission-tree {
    border: 1px solid #e4e7ed;
    border-radius: 4px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;

    /* 滚动条样式 */
    &::-webkit-scrollbar {
        width: 6px;
    }

    &::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }

    &::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 3px;
    }

    &::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }
}

// 图标选择器样式
.icon-selector {
    max-height: 400px;
    overflow-y: auto;

    .icon-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }

    .icon-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 12px;
        border: 1px solid #e4e7ed;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.3s ease;

        &:hover {
            border-color: #409eff;
            background-color: #f0f9ff;
        }

        &.active {
            border-color: #409eff;
            background-color: #ecf5ff;
            color: #409eff;
        }

        .el-icon {
            font-size: 24px;
            margin-bottom: 8px;
        }

        .icon-name {
            font-size: 12px;
            text-align: center;
            word-break: break-all;
        }
    }

    /* 滚动条样式 */
    &::-webkit-scrollbar {
        width: 6px;
    }

    &::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }

    &::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 3px;
    }

    &::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }
}